Python 201 by Michael Driscoll

Python 201 by Michael Driscoll

Author:Michael Driscoll
Language: eng
Format: epub, pdf
Publisher: leanpub.com
Published: 2016-04-06T16:00:00+00:00


Inserting Data

Right now our database is empty. That’s not very useful, so in this section we will learn how to add some data to it. Here’s the general idea:

1 INSERT INTO table_name (id, name, make, model, year) 2 VALUES (1, 'Marly', 'Ford', 'Explorer', '2000');

SQL uses the INSERT INTO commands to add data to the specified database. You also specify why columns you are adding data too. When we create the table, we can specify required column which could cause an error to be raised if we didn’t add data to a required column. However we didn’t do that in our table definition earlier. It’s just something to keep in mind. You will also receive an error if you pass the wrong data type, which I did for the year. I passed in a string or varchar instead of a date. Of course, each database requires a different date format, so you’ll want to figure out what DATE even means for your database.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.